package it.polimi.TravelDream.web.beans;

import it.polimi.TravelDream.ejb.dtos.ExcursionDTO;
import it.polimi.TravelDream.ejb.eaos.ExcursionList;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "excursion")
@RequestScoped
public class ExcursionBean {
	
	@EJB
	private ExcursionList excursionList;
	
	private ExcursionDTO current;
	
	public ExcursionBean() {
		this.current = new ExcursionDTO();
	}
	
	public String GoToCreateExcursion(){
		return "excursion?faces-redirect=true";
	}
	
	public String GoToSearchExcursion() {
		return "search excursion?faces-redirect=true";
	}
	
	public String create() {
		excursionList.add(current);
		return "home?faces-redirect=true";
	}
	
	public ExcursionDTO getCurrent() {
		return current;
	}
	
	public void setCurrent(ExcursionDTO current){
		this.current = current;
	}
}
